<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//echo "tax1";

require_once("includes/connect.php");
require_once("includes/function.php");

$sql = "SELECT * "
        . " FROM tbl_config "
        . " WHERE id = '1'";
$result = mysql_query($sql);
$r = mysql_fetch_object(mysql_query($sql));
$sso = $r->sso;

$sso /= 100;
//$sql = " SELECT SUM( tbl_init.salary * $sso ) AS sso "
//        . " FROM  tbl_salary , tbl_init "
//        . " WHERE tbl_salary.id = tbl_init.card_id ";
$sql = " SELECT tbl_init.salary"
        . " FROM  tbl_salary , tbl_init "
        . " WHERE tbl_salary.id = tbl_init.card_id ";

$result = mysql_query($sql);
$sum_sso = 0;
while ($rows = mysql_fetch_object($result)) {
    
    if ($rows->salary >= 15000) {
        $sum_sso += 15000 * $sso;
    } else {
        $sum_sso += $rows->salary * $sso;
    }
}

echo $sum_sso;

?>

